<?php 
/**
 * 鸡蛋美术 活动版块
 * ============================================================================
 * * 版权所有 20013-* 梅州络客网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.alork.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: liubo $
 * $Id: index.php 17217 2013-10-19 06:29:08Z liubo $
*/
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
require(ROOT_PATH . 'includes/lib_order.php');

if ((DEBUG_MODE & 2) != 2)
{
    $smarty->caching = true;
}



/*宝藏数组*/
$content= array('1223123' => '54',
                'faefq231' => '55',
                'fbdry542' => '56',
                'bsdvgfhj211' => '57',
                'bsdgdrfh143' => '58',
    );




/* 礼包详情 */
if($_REQUEST['act'] == 'info'){
    $key = !empty($_REQUEST['key'])?$_REQUEST['key']:'';


    if(!empty($key)){
        $parent_id = $content[$key];

    }else{
        /* 如果没有找到任何记录则跳回到首页 */
        ecs_header("Location: ./\n");
        exit;
    }
    if(empty($parent_id)){
        ecs_header("Location: ./\n");
    }
/*查询库存为0时正常跳转*/
    $sql = "SELECT valid_number from ".$ecs->table('activity_stock') . " WHERE parent_id = '$parent_id' ";
    $stock = $db->getOne($sql);
    /* 获取礼包信息 */
    $sql = "SELECT * FROM " . $ecs->table('activity') . " WHERE parent_id = '$parent_id' AND min_price > 9000 AND is_sale= 1";
    $info = $db->getRow($sql);
    if (empty($info)) {
         ecs_header("Location: ./\n");
    }

    $sql = "SELECT goods_id FROM ".$ecs->table('activity_goods') . " WHERE parent_id = '$parent_id'";
    $goods_id = $db->getOne($sql);
    $sql = "SELECT goods_thumb,goods_name AS name FROM ".$ecs->table('goods') ." WHERE goods_id = '$goods_id'";
    $goods_info = $db->getRow($sql);
    $smarty->assign('stock', $stock);
    $smarty->assign('goods_info', $goods_info);
    $smarty->assign('info', $info);
    $smarty->assign('top_title', '宝藏');
    $smarty->display('free_goods.dwt');
}


 ?>